﻿$(function () {
    window.progressDialog = new ProgressDialog();
    window.infoDialog = new InfoDialog();
    window.ajaxClass = new AjaxClass();
    window.selectOption = new SelectOption();
    $("#ButtonSave").button({ icons: { primary: "ui-icon-disk"} }).click(function () {
        var JsonSend = { "ActionParameters": JSON.stringify([[{ "OperationKey": "修改客户信息", "Parameters": { "@ct_area": $("#ct_area").val(), "@ct_type": $("#ct_type").val(), "@loc_id": $("#loc_id").val(), "@ct_cn_name": $("#ct_cn_name").val(), "@ct_addr": $("#ct_addr").val(), "@user_id": $("#user_id").val(), "@ct_linkman": $("#ct_linkman").val(), "@phone": $("#phone").val(), "@moblie": $("#moblie").val(), "@fax": $("#fax").val(), "@remark ": $("#remark").val()}}]]) };
        window.ajaxClass.AjaxSubmit(JsonOriginal.UrlAction, JsonSend, "", "window.location.href = JsonOriginal.UrlReferrer;", "", true, false);
    });
    $("#ButtonBack").button({ icons: { primary: "ui-icon-arrowreturnthick-1-w"} }).click(function () { window.location.href = JsonOriginal.UrlReferrer; });
    if (HasntPermission("修改客户资料")) { $("#ButtonSave").button({ disabled: true }); $("#MainTable .Unit select").attr("disabled", "disabled").attr("readonly", "readonly"); $("#MainTable .Unit input, #MainTable .Unit textarea").attr("readonly", "readonly"); }
    window.selectOption.SelectList("ct_area", JsonOriginal.Operations["客户区域"].OperationData, JsonOriginal.Operations["浏览客户信息"].OperationData[0]["ct_area"], JsonOriginal.Operations["浏览客户信息"].OperationData[0]["ct_area"], false);
    window.selectOption.SelectList("ct_type", JsonOriginal.Operations["客户类型"].OperationData, JsonOriginal.Operations["浏览客户信息"].OperationData[0]["ct_type"], JsonOriginal.Operations["浏览客户信息"].OperationData[0]["ct_type"], false);
    window.selectOption.SelectList("loc_id", JsonOriginal.Operations["货位"].OperationData, JsonOriginal.Operations["浏览客户信息"].OperationData[0]["loc_id"], JsonOriginal.Operations["浏览客户信息"].OperationData[0]["loc_id"], false);
});